import Vue from 'vue';
Vue.directive(
    'hasC',
    {
        inserted: function (el, binding) {
            if (binding.value) {
                let menus = JSON.parse(localStorage.getItem('menus'));
                let power = menus.action;
                if (typeof binding.value === 'string') {
                    let flag = power.find((ee) => ee.flag === binding.value);
                    if (!flag) el.style.display = 'none';
                } else {
                    let flag = power.find(
                        (ee) =>
                            ee.flag === binding.value.flag &&
                            ee.marking === binding.value.name
                    );
                    if (!flag) el.style.display = 'none';
                }
            }
        }
    }
);
